class Time_t {
public:
	Time_t() 
	: m_hours(0), m_minutes(0), m_seconds(0) {
	}
	
	Time_t(int hours, int minutes, int seconds) 
	: m_hours(hours), m_minutes(minutes), m_seconds(seconds) {
		if(!isValid(hours, minutes, seconds))
			throw out_of_range("...");
	}
	
	Time_t(const Time_t& other)
	: m_hours(other.m_hours), m_minutes(other.m_minutes), m_seconds(other.m_seconds)	{
	}
	
	virtual ~Time_t() {
	}
	
	virtual Time_t& operator=(const Time_t& other) {
		if(this != &other) {
			m_hours = other.m_hours;
			m_minutes = other.m_minuts;
			m_seconds = other.m_seconds;
		}
		
		return *this;
	}
	
	virtual bool operator<(const Time_t& other) const {
		if(m_hours < other.hours)
			return true;
			
		if(m_hours > other.hours)
			return false;
			
		if(m_minutes < other.m_minutes)
			return true;
			
		if(m_minutes > other.m_minutes)
			return false;
			
		if(m_seconds < other.m_seconds)
			return true;
			
		return false;
	}
	
	virtual Time_t operator+(const Time_t& other) const {
		return Time_t(m_hours + other.m_hours,
					  m_minutes + other.m_minutes,
					  m_seconds + other.m_seconds);
	}
	
	virtual Time_t& operator++() {
		if(!isValid(m_hours+1, m_minutes+1, m_seconds+1))
			throw out_of_range("...");
			
		m_hours++;
		m_minutes++;
		m_seconds++;
		return *this;
	}
	
	virtual Time_t operator++(int) {
		if(!isValid(m_hours+1, m_minutes+1, m_seconds+1))
			throw out_of_range("...");
		
		Time_t oldTime(*this);
		m_hours++;
		m_minutes++;
		m_seconds++;
		return oldTime;
	}
	
	virtual bool operator==(const Time_t& other) const {
		return (!(*this < other) && !(other < *this));
	}
	
	virtual void print() const {
		if(m_format == 1) {
			//...
		}
		else { // m_format == 2
			// ...
		}
	}
	
	virtual bool setTime(int hours, int minutes, int seconds) {
		if(!isValid(hours, minutes, seconds))
			return false;
			
		m_hours = hours;
		m_minutes = minuts;
		m_seconds = seconds;
		return true;
	}
	
	inline int hours() const {
		return m_hours;
	}
	
	inline int minutes() const {
		return m_minutes;
	}
	
	inline int seconds() const {
		return m_seconds;
	}
	
	static void setFormat(int format) {
		if(format == 1 || format == 2)
			m_format = format;
	}
	
	friend ostream& operator<<(ostream& os, const Time_t& time) {
		return os << "h: " << m_hours << ", m: " << m_minutes << ", s: " << m_seconds;
	}
	
	friend istream& operator>>(istream& is, Time_t& time) {
		int hours = -1, minutes = -1, seconds = -1;
		is >> hours >> minutes >> seconds;
		setTime(hours, minutes, seconds);
		return is;
	}
	
protected:
	static bool isValid(int hours, int minutes, int seconds) {
		if(hours < 0 || hours > 23)
			return false;
			
		if(minutes < 0 || minutes > 59)
			return false;
		
		if(seconds < 0 || seconds > 59)
			return false;

		return true;
	}
	
private:
	int m_hours;
	int m_minutes;
	int m_seconds;
	
	static int m_format;
};

int Time_t::m_format = 1;